*
* Table Propensity Score (Appendix)
*
set varabbrev off, permanently
clear all
use epfipc2006-2019plus.dta
*
* Total expenditure
*
global listtotal gasto1-gasto12 year2-year13 ccaa2-ccaa18 income squaredm othehouse ///
       ttenure2-ttenure6 tsize2-tsize5 pdensity2-pdensity3 residshort nmembers nfemales ///
	   nforeign ndworkers n5_15 n16_24 n25_34 n35_64 n65_79 n80omas nstudies2-nstudies4 ///
	   nactive nincome labinc peninc uneinc capinc agemb femalemb foreignmb unemployedmb inactivemb
*
*
foreach var1 in T10 T21 T01 T12 {
	preserve
	dis in blue "`var1'"
    keep if post==0 & `var1'!=.
	* Expenditure and income in thousands of euros just to get coefficient 
	* estimates on these variables that are greater than zero
	foreach pgas of varlist gasto1-gasto12 income {
		replace `pgas'=`pgas'/1000
	}
	* propensity score estimation with survey weights
    logit `var1' $listtotal  [pweight=factor]
	*outreg2 using tablepsgastototal, tex dec(4)
	restore
}
*
* Expenditure per equivalent adult
*
global listtotalaeq gastoaeq1-gastoaeq12 year2-year13 ccaa2-ccaa18 income squaredm othehouse ///
       ttenure2-ttenure6 tsize2-tsize5 pdensity2-pdensity3 residshort nmembers nfemales ///
	   nforeign ndworkers n5_15 n16_24 n25_34 n35_64 n65_79 n80omas nstudies2-nstudies4 ///
	   nactive nincome labinc peninc uneinc capinc agemb femalemb foreignmb unemployedmb inactivemb
*
foreach var1 in T10 T21 T01 T12 {
	preserve
	dis in blue "`var1'"
    keep if post==0 & `var1'!=.
	* Expenditure and income in thousands of euros just to get coefficient 
	* estimates on these variables that are greater than zero
	foreach pgas of varlist gastoaeq1-gastoaeq12 income {
		replace `pgas'=`pgas'/1000
	}
	* propensity score estimation with survey weights
    logit `var1' $listtotalaeq  [pweight=factor]
	*outreg2 using tablepsperadult, tex dec(4)
	restore
}
*
* Budget shares
*
global listtotalbs share1-share12 year2-year13 ccaa2-ccaa18 income squaredm othehouse ///
       ttenure2-ttenure6 tsize2-tsize5 pdensity2-pdensity3 residshort nmembers nfemales ///
	   nforeign ndworkers n5_15 n16_24 n25_34 n35_64 n65_79 n80omas nstudies2-nstudies4 ///
	   nactive nincome labinc peninc uneinc capinc agemb femalemb foreignmb unemployedmb inactivemb
*
foreach var1 in T10 T21 T01 T12 {
	preserve
	dis in blue "`var1'"
    keep if post==0 & `var1'!=.
	* Expenditure shares in % and income in thousands of euros
	foreach pgas of varlist share1-share12 {
		replace `pgas'=`pgas'*100
	}
	replace income=income/1000
	* propensity score estimation with survey weights
    logit `var1' $listtotalbs  [pweight=factor]
	*outreg2 using tablepsshare, tex dec(4) 
    restore
}
* The End
